<template>
  <div class="user-info shadow__box">
    <img class="user-avatar" width="120" height="120" v-lazy="webInfo.avatar" />
    <div class="web-name">{{ webInfo.name }}</div>
    <div class="web-info">
      <div class="blog-info-box">
        <span>文章</span>
        <span class="blog-info-num">{{ webCount.articleCount }}</span>
      </div>
      <div class="blog-info-box">
        <span>分类</span>
        <span class="blog-info-num">{{ webCount.categoryCount }}</span>
      </div>
      <div class="blog-info-box">
        <span>标签</span>
        <span class="blog-info-num">{{ webCount.tagCount }}</span>
      </div>
    </div>
    <a class="collection-btn">
      <i class="iconfont icon-xinghao" style="margin-right: 2px"></i>朋友圈
    </a>
  </div>
</template>
<script lang="ts" setup>
import { useWebInfoStore } from "@/store/webInfo.store";
import { storeToRefs } from "pinia";
import { onMounted } from "vue";
const store = useWebInfoStore();
const { getWebCount } = store;
const { webInfo, webCount } = storeToRefs(store);
onMounted(() => {
  getWebCount();
});
</script>
<style lang="scss" scoped>
.user-info {
  background: linear-gradient(
    -45deg,
    #e8d8b9,
    #eccec5,
    #a3e9eb,
    #bdbdf0,
    #eec1ea
  );
  background-size: 400% 400%;
  animation: linear-gradient(-90deg, #ee7752, #e73c7e, #23a6d5, #23d5ab) 10s
    ease infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 10px;
  position: relative;
  /*color: var(--white);*/
  overflow: hidden;
  padding-top: 20px;
  .user-avatar {
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
    &:hover {
      transform: rotate(360deg);
    }
  }
}

.card-content1 :not(:first-child) {
  z-index: 10;
}

.web-name {
  font-size: 30px;
  font-weight: bold;
  margin: 20px 0;
}

.web-info {
  width: 80%;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
}

.blog-info-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
}

.blog-info-num {
  margin-top: 12px;
}

.collection-btn {
  position: relative;
  margin-top: 12px;
  background: #39c5bb;
  cursor: pointer;
  width: 65%;
  height: 35px;
  border-radius: 1rem;
  text-align: center;
  line-height: 35px;
  color: #fff;
  overflow: hidden;
  z-index: 1;
  margin-bottom: 25px;
}

.collection-btn::before {
  background: linear-gradient(to right, #ff4b2b, #ff416c);
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  content: "";
  transform: scaleX(0);
  transform-origin: 0;
  transition: transform 0.5s ease-out;
  transition-timing-function: cubic-bezier(0.45, 1.64, 0.47, 0.66);
  border-radius: 1rem;
  z-index: -1;
}

.collection-btn:hover::before {
  transform: scaleX(1);
}
</style>
